<template>
  <div class="creationType">
    <el-form
      :inline="true"
      :model="formInline"
      class="demo-form-inline"
      size="small"
    >
      <el-form-item label="创作类型名称">
        <el-input
          v-model="formInline.creationTypeName"
          placeholder="创作类型名称"
        ></el-input>
      </el-form-item>
      <el-form-item>
        <el-button type="primary" @click="getList">查询</el-button>
      </el-form-item>
    </el-form>
    <el-table :data="tableData" border style="width: 100%">
      <el-table-column prop="creationTypeName" label="创作类型名称">
        <template slot-scope="scope">
          <span>{{scope.row.creationTypeModel.creationTypeName}}</span>
        </template>
      </el-table-column>
      <el-table-column prop="sort" label="创作类型顺序">
        
        <template slot-scope="scope">
          <span>{{scope.row.creationTypeModel.sort}}</span>
        </template>
      </el-table-column>
      <el-table-column label="操作">
        <template slot-scope="scope">
          <el-button type="text" @click="view(scope.row.creationTypeModel.id)">管理</el-button>
        </template>
      </el-table-column>
    </el-table>
    <!-- <div class="block pageCont">
      <el-pagination
        @size-change="handleSizeChange"
        @current-change="handleCurrentChange"
        :current-page="currentPage"
        :page-size="pageSize"
        layout="total, sizes, prev, pager, next, jumper"
        :total="total"
      >
      </el-pagination>
    </div> -->
  </div>
</template>
<script>
import { CreationTypeListByTypeId } from "@/api/creationType";
export default {
  data() {
    return {
      tableData: [],
      formInline: {},
      currentPage: 1,
      total: 0,
      pageSize: 20,
    };
  },
  created() {
    this.getList();
  },
  methods: {
    handleSizeChange() {},
    handleCurrentChange(val) {
      this.currentPage = val;
      this.getList();
    },
    getList() {
      CreationTypeListByTypeId({
        page: this.currentPage,
        ...this.formInline,
      }).then((res) => {
        this.tableData = res.data;
        this.total = res.data.total;
      });
    },
    view(id){
      this.$router.push({name:'creationTypeChild',query:{typeId:id}})
    }
  },
};
</script>
<style lang="scss" scoped>
</style>